#ifndef __GAME_PLAY_LAYER__
#define __GAME_PLAY_LAYER__

#include "cocos-ext.h"
USING_NS_CC_EXT;
#include "Header.h"
#include "HNAlertView.h"
#include "GameManager.h"

class Road;
class InputField;

class GamePlayLayer: public CCLayer
{
public:
	GamePlayLayer();
	~GamePlayLayer();
	CREATE_FUNC(GamePlayLayer);

	bool init();
	bool ccTouchBegan(CCTouch *pTouch, CCEvent *pEvent);
	void ccTouchMoved(CCTouch *pTouch, CCEvent *pEvent);

private:
	CCPoint currentTouchPoint;
	Road* road;
	CCLabelTTF* numVerhicleLabel;
	CCLabelTTF* timeLabel;
    CCLabelTTF* endTimeLabel;
//	CCTimer* gameTimer;
	bool isShowingAlert;

	void addControls();
	void update(float delta);
	void onEnter();

	void scrollRight(CCObject *sender, CCControlEvent controlEvent);
	void scrollLeft(CCObject *sender, CCControlEvent controlEvent);
	void scrollToBegin(CCObject *sender, CCControlEvent controlEvent);
	void scrollToEnd(CCObject *sender, CCControlEvent controlEvent);
	void settingButtonTouched(CCObject *sender, CCControlEvent controlEvent);
	void replayButtonTouched(CCObject *sender, CCControlEvent controlEvent);
	void resetGame();
//	void alertViewButtonTouched(int index, char* inputString);
	void oneSecondTick(float t);
	void showAlertSaveGame();
    void updateTimeLabel();
    void updateEndTimeLabel();
    void gameTimeChangeNotification(CCObject* obj);
};
#endif // !__GAME_PLAY_LAYER__
